#import <stdlib.h>
#import <stdio.h>
#import <zone.h>
#import <mach.h>

#define allc_min 8192

char *space( sz, obsz )
int sz, obsz;
{
    char	*p;

    if ( (sz * obsz) < allc_min ) {
	if ( (p = (char *) NXZoneMalloc( NXDefaultMallocZone(), 
		malloc_good_size(allc_min) )) == NULL ) {
	  fprintf(stderr,"No Memory!\n");
	  exit(-1);
	}
    }
    else {
	if ( (p = (char *) NXZoneMalloc( NXDefaultMallocZone(),
		malloc_good_size(sz * obsz) )) == NULL ) {
	  fprintf(stderr,"No Memory!\n");
	  exit(-1);
	}
    }
    return p;
}

char *zspace( zoned, sz, obsz )
NXZone *zoned; int sz, obsz;
{
    char	*p;

    if ( (sz * obsz) < allc_min ) {
	if ( (p = (char *) NXZoneMalloc( zoned, malloc_good_size(allc_min) 
					)) == NULL ) {
	    fprintf(stderr,"No Memory!\n");
	    exit(-1);
	}
    }
    else {
	if ( (p = (char *) NXZoneMalloc( zoned, malloc_good_size(sz * obsz) 
					)) == NULL ) {
	    fprintf(stderr,"No Memory!\n");
	    exit(-1);
	}
    }
    return p;
}
